
const createDepartmentService = () => import("~/services/management-service/department.service")
const createRoleService = () => import("~/services/management-service/role.service")
import { CommonService } from "~/utils/common.service";


export default {
  namespaced: true,
  state: {
    modulePermissRoleId: '', // 用户角色Id
    modulePermissDialog: false,
    modulePermissRoleCode: '',
    // orgInfo: [], // 组织名称信息
    companyName: [], // 公司名称
    resource: [], // 所有资源
  },
  getters: {
    menuResource() {

    }

  },
  mutations: {
    // 用户角色Id
    updateModuleRoleId(state, val) {
      state.modulePermissRoleId = val
    },
    updateModuleRoleCode(state, val) {
      state.modulePermissRoleCode = val
    },
    updateModuleDialog(state, val) {
      state.modulePermissDialog = val
    },
    updateResource(state, value) {
      state.resource = value
    },
  },
  actions: {
    /**
     * 所有资源
     * @param param0 
     */
    async updateResource({ state, commit }) {
      const { RoleService } = await createRoleService()
      RoleService.getInstance().getAllResources().subscribe(data => {
        commit("updateResource", data)
      })
    },
  }
}
